/**
 * There are code generation
 */
package com.neusoft.lohas.modules.ivm.dao.order;

import org.springframework.stereotype.Repository;

import com.neusoft.lohas.common.persistence.BaseDao;
import com.neusoft.lohas.common.persistence.Parameter;
import com.neusoft.lohas.modules.ivm.entity.order.UserAddress;

/**
 * 用户收货地址DAO接口
 * @author Jackie.Liu
 * @version 2014-12-16
 */
@Repository
public class UserAddressDao extends BaseDao<UserAddress> {

	public int updateDefaultFlag(String userId) {
		return update("update UserAddress set defaultFlag=0 where user.id = :p1 and del_flag = :p2", new Parameter(userId, UserAddress.DEL_FLAG_NORMAL));
	}
	
	public UserAddress getByNameAndPhone(String name, String phone) {
		try {
			return getByHql("from UserAddress where name=:p1 and phone=:p2", new Parameter(name, phone));
		} catch (Exception e) {
			return null;
		}
	}
	
}
